/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K250;
import queenb.web.inteface.K250Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class K250Store extends K250 implements K250Inf {

    @Override
    public List<K250> getListK250All(int pnFH200, int pnFH000, String pvLOGIN) {
       try {
            DataStatement data = new DataStatement(PackageContants.LIST_K250, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, K250.class);
        } catch (SQLException ex) {
            Logger.getLogger(K250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateK250(int pnPK250, String pvKV251, int pnFH000, int pnFH200, String pvLOGIN) {
       DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_K250, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPK250),
                    new Param(OracleTypes.CHAR, pvKV251),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, K250.class);
        } catch (SQLException ex) {
            Logger.getLogger(K250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteK250(int pnPK250, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_K250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPK250),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, K250.class);
        } catch (SQLException ex) {
            Logger.getLogger(K250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    
}
